<template>
	<view>
		<text>你需要发送验证申请，等对方通过</text>
		<input type="text" v-model="saySomething"/>
		<!--  #ifdef  MP-WEIXIN-->
		<view class="btn" @click="addFriend">
			发送
		</view>
		<!--  #endif -->
	
	</view>
</template>

<script>
	import util from '../../utils/index.js'
	export default {
		data() {
			return {
				inviter: '',
				saySomething:''
			}
		},
		onNavigationBarButtonTap(e) {
			if (e.text !== '&nbsp') this.addFriend()
		},
		onLoad(option){
			this.inviter=option.inviter
		},
		methods: {
			addFriend() {
				let {
					uuid
				} = uni.getStorageSync('user')
				util.myRequest({
					url: '/addFriend/request',
					data: {
						initiator: uuid,
						saySomething:this.saySomething,
						inviter: this.inviter
					}
				}).then(res=>{
					if(res.code==='001'){
						uni.showToast({
							title:"发送成功",
							success(){
								uni.navigateBack({
									 delta: 1
								})
							}
						})
					}
				})
			}
		}
	}
</script>

<style>
	page {
		background-color: #ededed;

	}

	text {
		font-size: 22upx;
		color: #999;
	}

	input {
		background-color: #fff;
		height: 100upx;
		line-height: 100upx;
		font-size: 32upx;
		margin-top: 10upx;
	}
	.btn{
		font-size: 27upx;
		color: #294477;
		text-align: center;
		line-height: 100upx;
		margin: 15upx 0;
		background-color: #fff;
		}
		
</style>
